import request from "@/utils/request";
import { object_Inf } from "@/utils/typings/index.type";
import equipBaseInfo_APi from "../equipBaseInfo";
/*
 * @Descripttion:设备维修接口类
 * @LastEditors: xzh
 * @LastEditTime: 2023-09-12 20:33:04
 */
export default class equipRepair_APi extends equipBaseInfo_APi {
  //#region 设备维修类型接口

  /**
   * @Author: xzh
   * @Descripttion:保存设备维类型修信息
   * @Param:
   * @param {object} data
   */
  static saveEquipRepairType = (data: object): Promise<object_Inf> =>
    request({
      url: "/api/RepairType/SaveRepairType",
      method: "post",
      data,
      headers: { "Content-Type": "application/json;charset=UTF-8" },
    });
  /**
   * @Author: xzh
   * @Descripttion: 删除设备维修类型信息
   * @Param:
   * @param {Array} data
   */
  static deleteEquipRepairType = (data: Array<string>): Promise<object_Inf> =>
    request({
      url: "/api/RepairType/DeleteRepairType",
      method: "post",
      data,
      headers: { "Content-Type": "application/json;charset=UTF-8" },
    });
  /**
   * @Author: xzh
   * @Descripttion: 修改设备维修类型状态
   * @Param:
   * @param {Array} data
   */
  static updateEquipRepairTypeStatus = (
    data: Array<string>,
    status: boolean
  ): Promise<object_Inf> =>
    request({
      url: "/api/RepairType/UpdateRepairTypeStatus",
      method: "post",
      data: {
        ids: data,
        status,
      },
      headers: { "Content-Type": "application/json;charset=UTF-8" },
    });
  /**
   * @Author: xzh
   * @Descripttion: 获取设备维修类型信息
   * @Param:
   * @param {number} id 设备维修类型主键
   */
  static getEquipRepairTypeInfo = (id: number): Promise<object_Inf> =>
    request({
      url: "/api/RepairType/GetRepairType",
      method: "get",
      params: { id },
    });
  /**
   * @Author: xzh
   * @Descripttion:获取设备维修类型列表
   * @Param:
   */
  static getEquipRepairTypeList = (
    data: object_Inf = {
      keyWord: "",
    }
  ): Promise<Array<object_Inf>> =>
    request({
      url: "/api/RepairType/GetRepairTypeList",
      method: "post",
      data,
      headers: { "Content-Type": "application/json;charset=UTF-8" },
    });

  //#endregion

  //#region 设备维修记录接口

  /**
   * @Author: xzh
   * @Descripttion:保存设备维修记录信息
   * @Param:
   * @param {object} data
   */
  static saveEquipRepairRecord = (data: object): Promise<object_Inf> =>
    request({
      url: "/api/RepairRecord/SaveRepairRecord",
      method: "post",
      data,
      headers: { "Content-Type": "application/json;charset=UTF-8" },
    });
  /**
   * @Author: xzh
   * @Descripttion: 删除设备维修记录信息
   * @Param:
   * @param {Array} data
   */
  static deleteEquipRepairRecord = (data: Array<string>): Promise<object_Inf> =>
    request({
      url: "/api/RepairRecord/DeleteRepairRecord",
      method: "post",
      data,
      headers: { "Content-Type": "application/json;charset=UTF-8" },
    });
  /**
   * @Author: xzh
   * @Descripttion: 获取设备维修记录信息
   * @Param:
   * @param {number} id 设备维修记录主键
   */
  static getEquipRepairRecordInfo = (id: number): Promise<object_Inf> =>
    request({
      url: "/api/RepairRecord/GetRepairRecord",
      method: "get",
      params: { id },
    });
  /**
   * @Author: xzh
   * @Descripttion:获取设备维修记录列表
   * @Param:
   */
  static getEquipRepairRecordList = (
    data: object_Inf = {
      keyWord: "",
    }
  ): Promise<object_Inf> =>
    request({
      url: "/api/RepairRecord/GetRepairRecordList",
      method: "post",
      data,
      headers: { "Content-Type": "application/json;charset=UTF-8" },
    });

  //#endregion
}
